package com.majun.huaxishe.service.impl;

import com.majun.huaxishe.constant.InfoConstant;
import com.majun.huaxishe.entity.Staff;
import com.majun.huaxishe.exception.LoginException;
import com.majun.huaxishe.mapper.StaffMapper;
import com.majun.huaxishe.service.IStaffService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 员工表 服务实现类
 * </p>
 *
 * @author 马骏
 * @since 2024-02-29
 */
@Service
public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements IStaffService {

    @Override
    public void login(Staff staff) {
        Staff one = lambdaQuery()
                .eq(Staff::getUsername, staff.getUsername())
                .eq(Staff::getPassword, staff.getPassword())
                .one();
        if (one == null){
            throw new LoginException(InfoConstant.LOGIN_FAIL);
        }
    }
}
